<template>
    <div class="g-flex-center g-height100 g-width100 login-bg">
        <LoginComp style="width: 500px;" class="login-form" v-on:success="loginSuccess"></LoginComp>
    </div>
</template>
<script>
import LoginComp from '../../../../common-util/src/components/login/Login.vue'
import StorageTools from '../../../../common-util/src/tools/StorageTools'

    export default {
        name: 'Login',
        components: {
            LoginComp
        },
        created () {
        },
        methods: {
            loginSuccess(){
                let beforeLoginUrl = StorageTools.sessionGet("beforeLoginUrl")
                if(beforeLoginUrl){
                    StorageTools.sessionRemove("beforeLoginUrl")
                    window.location.replace(beforeLoginUrl)
                }else{
                    this.$router.replace('/selectApplication')
                    // 临时解决方案，因为导航项目在登录页面是无法挂载的
                    //window.location.href=window.location.href.replace('login','')
                }

            }
        },
        data () {
            return {}
        },
        destroyed() {
        },
        watch: {
        }
    }
</script>
<style scoped>
    .login-form{
        width: 30rem !important;
        padding: 2rem;
        background: rgba(255, 255, 255, 0.5) none repeat scroll 0 0;
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 3px;
        box-shadow: 0 3px 0 rgba(12, 12, 12, 0.03);
    }
    .login-bg {
        background: url("../../assets/login-bg1.jpg") no-repeat;
        background-size: cover;
    }
</style>
